<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="../templates/defaultLayout.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">

	<ui:define name="title">#{msg.altaAsignatura}</ui:define>

	<ui:define name="content">
		<rich:panel>
			<f:facet name="header">
				<h:outputText value="#{msg.altaAsignatura}" />
			</f:facet>

			<h:form id="formAltaAsignatura">
				<h:panelGrid id="panelAltaAsignatura" columns="3">

					<h:outputText value="#{msg.nombre}" />
					<h:inputText id="nombre" label="Nombre"
						value="#{asignaturasBean.asignaturaEditar.nombre}" required="true"
						requiredMessage="#{msg.requiredNombre}"
						validatorMessage="#{msg.validateNombre}">
						<f:validateLength maximum="50"/>
					</h:inputText>
					<rich:message for="nombre" ajaxRendered="true" />

					<h:outputText value="#{msg.curso}" />
					<h:inputText id="curso" label="Curso"
						value="#{asignaturasBean.asignaturaEditar.curso}" required="true"
						requiredMessage="#{msg.requiredCurso}"
						converterMessage="#{msg.converterCurso}"
						validatorMessage="#{msg.validateCurso}">
						<f:convertNumber integerOnly="true" />
						<f:validateLongRange minimum="1" maximum="5" />
					</h:inputText>
					<rich:message for="curso" ajaxRendered="true" />

					<h:outputText value="#{msg.creditos}" />
					<h:inputText id="creditos" label="Creditos"
						value="#{asignaturasBean.asignaturaEditar.credito}"
						required="true" requiredMessage="#{msg.requiredCreditos}"
						validatorMessage="#{msg.validateCreditos}">
						<f:validateDoubleRange minimum="1" maximum="15" />
					</h:inputText>
					<rich:message for="creditos" ajaxRendered="true" />

					<p />

					<f:facet name="footer">
				        <a4j:commandButton id="btnGuardar" value="#{msg.guardar}"
							action="#{asignaturasBean.altaAsignatura}"
							render="panelAltaAsignatura"/>
					</f:facet>
					<rich:message for="btnGuardar" ajaxRendered="true" />

				</h:panelGrid>
			</h:form>
		</rich:panel>
	</ui:define>

</ui:composition>